package com.sslpay.merchant.common.domain;

import com.sslpay.common.domain.ErrorCode;

/**
 * 描述：商户应用错误码
 *
 * @author ssl
 * @create 2020/05/04 10:47
 */
public enum MerchantApplicationErrorCode implements ErrorCode {
    // 请求异常
    M_E_100101(100101, "参数错误"),
    M_E_100102(100102, "请求的资源不存在"),
    M_E_100103(100103, "不支持的请求方式"),

    // 商户相关异常
    M_E_200101(200101, "商户未找到"),
    M_E_200102(200102, "商户[id]不能为空"),
    M_E_200103(200103, "获取手机验证码失败"),
    M_E_200104(200104, "手机号[phone]不能为空"),
    M_E_200105(200105, "手机号[phone]格式不正确"),
    M_E_200106(200106, "验证手机验证码失败"),
    M_E_200107(200107, "注册信息不能为空"),
    M_E_200108(200108, "注册商户失败"),
    M_E_200109(200109, "读取上传的文件失败"),
    M_E_200110(200110,"文件上传至服务器失败"),
    M_E_200111(200111,"资质申请失败"),
    M_E_200112(200112,"请求头 'authorization' 无效"),

    // 未知异常
    UNKNOWN(999999, "未知错误");

    MerchantApplicationErrorCode(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    private int code;
    private String msg;


    /**
     * 获取异常码
     *
     * @return
     */
    @Override
    public int getCode() {
        return code;
    }

    /**
     * 获取异常消息
     *
     * @return
     */
    @Override
    public String getMsg() {
        return msg;
    }

    public MerchantApplicationErrorCode setMsg(String msg) {
        this.msg = msg;
        return this;
    }
}
